import Vue from 'vue'
// import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import 'element-ui/lib/theme-chalk/index.css'
import 'yxs-ui/lib/theme-chalk/index.css'
// import YxsUi from 'yxs-ui'
// import 'yxs-uii/lib/theme-chalk/index.css'
import YxsUi from 'yxs-ui/lib'
import './assets/globs.css'
import './assets/fonts/iconfont.css' // 引入字体图标
import axios from 'axios'
// 引入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
// import 'quill/dist/quill.core.css' // import styles
// import 'quill/dist/quill.snow.css' // for snow theme
// import 'quill/dist/quill.bubble.css' // for bubble theme
import Nprogress from 'nprogress' // 引入进度条
import 'nprogress/nprogress.css'
import Vueresource from 'vue-resource'
axios.defaults.baseURL = '/'
// axios.defaults.withCredentials = true
Vue.use(VueQuillEditor /* { default global options } */) // 注册为全局组件
axios.interceptors.request.use((config) => {
  Nprogress.start()

  config.headers.Authorization = window.sessionStorage.getItem('token') || ''
  return config
})
axios.interceptors.response.use((config) => {
  Nprogress.done()
  return config
})
// Vue.use(YxsUi)
Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(Vueresource)
Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')
  return `${y}-${m}-${d} ${hh}-${mm}-${ss}`
})
// router.beforeEach((to, from, next) => {
//     console.log('没有过来额')
//     if (to.path == '/getlun' && from.path == '/getlun') {

//         to.meta.keepAlive = true;  // 让 列表页 缓存，即不刷新
//         next();
//     } else {
//         to.meta.keepAlive = false;  // 让 列表页 即不缓存，刷新
//         next();
//     }
// })
new Vue({
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
